package com.rljk.service.impl;

import java.util.List;
import javax.annotation.Resource;

import com.rljk.service.TaskManager;
import org.springframework.stereotype.Service;
import com.rljk.common.dao.DaoSupport;
import com.github.pagehelper.PageHelper;
import com.rljk.domain.common.PageData;

/** 
 * 说明： 任务表
 * 创建人：zhaozhenhua
 * 创建时间：2018-06-26
 * @version
 */
@Service("taskService")
public class TaskService implements TaskManager {

	@Resource(name = "daoSupport")
	private DaoSupport dao;
	
	/**新增
	 * @param pd
	 * @throws Exception
	 */
	public void save(PageData pd)throws Exception{
		dao.save("TaskMapper.save", pd);
	}
	
	/**删除
	 * @param pd
	 * @throws Exception
	 */
	public void delete(PageData pd)throws Exception{
		dao.delete("TaskMapper.delete", pd);
	}
	
	/**修改
	 * @param pd
	 * @throws Exception
	 */
	public void edit(PageData pd)throws Exception{
		dao.update("TaskMapper.edit", pd);
	}
	
	/**分页列表
	 * @param currentPage
	 * @param pageSize
	 * @param pd
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	public List<PageData> listPage(int currentPage,int pageSize,PageData pd)throws Exception{
	    PageHelper.startPage(currentPage,pageSize);
		return (List<PageData>)dao.findForList("TaskMapper.listAll", pd);
	}
	
	/**列表(全部)
	 * @param pd
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	public List<PageData> listAll(PageData pd)throws Exception{
		return (List<PageData>)dao.findForList("TaskMapper.listAll", pd);
	}
	
	/**通过id获取数据
	 * @param pd
	 * @throws Exception
	 */
	public PageData findById(PageData pd)throws Exception{
		return (PageData)dao.findForObject("TaskMapper.findById", pd);
	}
	
	/**批量删除
	 * @param ArrayDATA_IDS
	 * @throws Exception
	 */
	public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
		dao.delete("TaskMapper.deleteAll", ArrayDATA_IDS);
	}

	/**后台获取任务详细列表(全部)
	 * @param pd
	 * @throws Exception
	 */
	public List<PageData> backendListAll(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("TaskMapper.backendListAll", pd);
	}

	/**
	 *app任务中心获取我发布的和我接受的任务
	 */
	@Override
	public List<PageData> getTaskCenter(PageData pd) throws Exception {
		return (List<PageData>)dao.findForList("TaskMapper.getTaskCenter", pd);
	}

}

